﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;

namespace CreateBigDate
{
    class Program
    {
        static void Main(string[] args)
        {
            var table = new DataTable();
            var baseCharArray = new List<string>
            {
                "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"
            };



            var fileToCreate = new FileStream("c:/excel.txt", FileMode.Create);
            var writer = new StreamWriter(fileToCreate, System.Text.Encoding.Default);

            var file1 = new FileStream("c:/1.txt", FileMode.Open);
            var reader1 = new StreamReader(file1);
            var phones = new List<String>();
            for (var i = 1; i <= 1000; i++)
            {
                phones.Add(reader1.ReadLine());
            }

            var file2 = new FileStream("c:/2.txt", FileMode.Open);
            var reader2 = new StreamReader(file2);
            var tagcodes = new List<string>();
            var fixedids = new List<string>();
            for (var i = 1; i <= 1000; i++)
            {
                var t = reader2.ReadLine().Split(new char[] { ',' });
                tagcodes.Add(t[0]);
                fixedids.Add(t[1]);
            }

            var r = new Random();
            var count = 215736;//*******************
            for (var i = 1; i <= count; i++)
            {
                //writer.WriteLine(r.Next(17600333, 31763270));


                var t = r.Next(1, 3);
                var o = new
                {
                    lat = "",
                    lon = ""
                };
                switch (t)
                {
                    case 1:
                        o = new
                        {
                            lat = (r.Next(28130128, 30211608) * 0.000001).ToString(),
                            lon = (r.Next(119013176, 120902824) * 0.000001).ToString()
                        };
                        break;
                    case 2:
                         o = new
                        {
                            lat = (r.Next(22277914, 24423144) * 0.000001).ToString(),
                            lon = (r.Next(111947388, 116781372) * 0.000001).ToString()
                        };
                        break;
                    case 3:
                         o = new
                        {
                            lat = (r.Next(26655314, 27408835) * 0.000001).ToString(),
                            lon = (r.Next(117189514, 120375549) * 0.000001).ToString()
                        };
                        break;
                }
                var index = r.Next(0, 999);
                var obj = new
                {
                    code = tagcodes[index],
                    fixedid = fixedids[index],
                    info_access_per = "",//phones[index]
                    site_latitude = o.lat,
                    site_Longitude = o.lon,//经度
                    Add_Time = "2013-" + r.Next(8, 12) + "-" + r.Next(1, 30) + " " + r.Next(9, 20) + ":" + r.Next(0, 59) + ":" + r.Next(0, 59) + "." + r.Next(0, 999)
                };
                writer.WriteLine(i + ",1," + obj.info_access_per + "," + obj.site_latitude + "," + obj.site_Longitude + ",,," + obj.Add_Time + "," + obj.code + ",1,,,,,,," + obj.fixedid + ",-1");
            }
            writer.Close();
            fileToCreate.Close();
            reader1.Close();
            reader2.Close();
            file1.Close();
            file2.Close();
        }



    }
}
